package com.sendtion.xrichtext;

import ohos.agp.components.Image;

/**
 * XRichText
 *
 * @since 2021-06-22
 */
public class XRichText {
    private static XRichText instance;
    private IImageLoader imageLoader;

    /**
     * getInstance
     *
     * @return XRichText
     */
    public static XRichText getInstance() {
        synchronized (XRichText.class) {
            if (instance == null) {
                instance = new XRichText();
            }
        }
        return instance;
    }

    public void setImageLoader(IImageLoader imageLoader) {
        this.imageLoader = imageLoader;
    }

    /**
     * loadImage
     *
     * @param imagePath
     * @param imageView
     * @param imageHeight
     */
    public void loadImage(String imagePath, Image imageView, int imageHeight) {
        if (imageLoader != null) {
            imageLoader.loadImage(imagePath, imageView, imageHeight);
        }
    }
}
